<%--
  Created by IntelliJ IDEA.
  User: zhongge
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String contextPath = request.getContextPath();
    com.zhongge.model.entity.User loginUser = (com.zhongge.model.entity.User) session.getAttribute("user");
%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>我的博客</title>
    <link rel="stylesheet" href="<%= contextPath %>/static/css/style.css">
</head>
<body>
<header class="header">
    <div class="logo">
        <a href="<%= contextPath %>/">我的博客</a>
    </div>
    <nav class="nav">
        <ul>
            <li><a href="<%= contextPath %>/">首页</a></li>
            <li><a href="<%= contextPath %>/article/list">文章</a></li>
        </ul>
    </nav>
    <div class="user-actions">
        <% if (loginUser == null) { %>
        <a href="<%= contextPath %>/user/loginPage" class="btn btn-sm">登录</a>
        <a href="<%= contextPath %>/user/registerPage" class="btn btn-sm btn-primary">注册</a>
        <% } else { %>
        <div class="dropdown">
            <span class="username"><%= loginUser.getNickname() != null ? loginUser.getNickname() : loginUser.getUsername() %></span>
            <div class="dropdown-menu">
                <a href="<%= contextPath %>/user/profile">个人资料</a>
                <a href="<%= contextPath %>/article/addPage">发布文章</a>
                <a href="<%= contextPath %>/category/list">分类管理</a>
                <a href="<%= contextPath %>/user/logout">退出登录</a>
            </div>
        </div>
        <% } %>
    </div>
</header>
<main class="main-content">